package org.lq.us.test;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;

public class Demo {

	public static void main(String[] args) {
		QRCodeWriter qrc = new QRCodeWriter();
		try {
			BitMatrix bitMatrix= qrc.encode("http://ypl94211.oicp.net/hnkj_user/PhoneLogin?code="+UUID.randomUUID().toString().replaceAll("-", ""), BarcodeFormat.QR_CODE, 350, 350);
			
			
			MatrixToImageWriter.writeToFile(bitMatrix, "png", new File("admin.png"));
		} catch (WriterException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
